package com.cnt.controller;

import com.cnt.entity.Evaluate;
import com.cnt.service.EvaluateService;
import com.cnt.vo.EvaluateVo;
import com.cnt.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/evaluate")
public class EvaluateController {

    @Autowired
    private EvaluateService evaluateService;

    @GetMapping("/getAllByDonationId")
    public ResultVo <List<EvaluateVo>> getAllByDonationId(@RequestParam("donationId") int donationId){
        return evaluateService.getAllByDonationId(donationId);
    }

    @PostMapping("/addByRequestId")
    public ResultVo<Void> addEvaluateByRequestId(@RequestBody Evaluate evaluate) {
        // 调用 evaluateService 的方法添加评价
        return evaluateService.addEvaluateByRequestId(evaluate);
    }

}
